package com.retail.bbq.cola.constant;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Configuration
@ConfigurationProperties(prefix = "api.forward")
public class ColaHttpUrlConfig {

    public String targetUrl;

    public String getForwardTargetUrl(String forwardPath) {
        return targetUrl.concat(forwardPath);
    }

    public String getProvinceCityAreaUrl() {
        return targetUrl + "/api/member-counter/mini/province_city_area/tree";
    }

    public String getOrderSyncUrl(String param) {
        return String.format(targetUrl + "/api/icoke-thirdorder/%s/third_order/third_api/push", param);
    }

    public String getAccessTokenUrl() {
        return targetUrl + "/api/platform-tenant/authentication/client";
    }

    /**
     * 查询权益是否发放
     * @param buCode
     * @return
     */
    public String querMemberProjectListUrl(String buCode) {
        return String.format(targetUrl + "/api/icoke-customer/%s/web/customer/main/querMemberProjectList", buCode);
    }

    public String getOrderNoticeUrl(String param) {
        return String.format(targetUrl + "/api/icoke-thirdorder/%s/third_order/third_api/push", param);
    }

    public String queryOrderList(String buCode, String campaignCode) {
        return String.format(targetUrl + "/api/icoke-thirdorder/%s/third_order/third_api/queryOrderList/%s", buCode, campaignCode);
    }

    public String getTargetUrl() {
        return targetUrl;
    }

    public void setTargetUrl(String targetUrl) {
        this.targetUrl = targetUrl;
    }

}
